var express = require("express");
var router = express.Router();
var jwt = require('jsonwebtoken')
var { secretKey } = require('../common/const')

/* GET users listing. */
router.get("/", function (req, res, next) {
  res.send("respond with a resource");
});

router.get('/login', function(req, res, next) {

  const token = jwt.sign({ username: 'liucao'}, secretKey, {expiresIn: '86400s'})

  res.send({token: token});
});

module.exports = router;
